How to make double[,] x_List in C#3.0?

Posted by Newbie on Stack Overflow See other posts from Stack Overflow or by Newbie
Published on 2010-04-27T09:17:39Z Indexed on 2010/04/27 9:23 UTC
Read the original article Hit count: 292

Filed under:

I ned to implement the multi-linear regression in C#(3.0) by using the LinESt function of Excel. Basically I am trying to achieve

=LINEST(ACL_returns!I2:I10,ACL_returns!J2:K10,FALSE,TRUE)

So I have the data as below

double[] x1 = new double[] { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090 };
double[] x2 = new double[] { -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 };
double[] y = new double[] { 0.4807, -3.7070, -4.5582, -11.2126, -0.7733, 3.7269, 2.7672, 8.3333, 4.7023 };

I have to write a function whose signature will be

Compute(double[,] x_List, double[] y_List)
{
   LinEst(x_List,y_List, true, true); < - This is the excel function that I will call.
}

My question is how by using double[] x1 and double[] x2 I will make double[,] x_List ?

I am using C#3.0 and framework 3.5.

Thanks in advance

© Stack Overflow or respective owner

Related posts about c#3.0